<?php
$tpl['title']="Visitors Stats | PHP Web Application Services";
include("../../../config.php"); 
include(TPL_DIR.$current_theme."/header.php");
include(TPL_DIR.$current_theme."/popup.php");
include(TPL_DIR.$current_theme."/tooltip.php");
?>
<link href="./css/style.css" type='text/css' rel="stylesheet"/>
<div id="pageContainer" style="margin-right:20px">
    <div class="hotsite hotsite-ele cur" id="hotsite" >
<!-- ========== online visitors ============== -->
        <span id="onlineVisitors" class="tooltip">
              <a class="hotsite_link" href="javascript:void(0)" >
                <img src="./images/users.png" class="i-hot-sprites"/>
                <label class="span-hot-name" style="visibility: visible;">المتواجدون الآن</label></a>
        </span>
		<em> 
			عدد المتواجدون لزيارة الموقع الآن :
			<?php 
			 $onlineUsers = UserStats::usersOnline("inc/usersOnline.txt",30);
			 echo sizeof($onlineUsers);
			
			?>
		</em>	 	
		<!-- ========== visitors country ============== -->
        <span id="visitorInfo" class="tooltip">
              <a class="hotsite_link" href="javascript:void(0)" >
                <img src="./images/ip2country.png" class="i-hot-sprites"/>
                <label class="span-hot-name" style="visibility: visible;"> بلد الزائر</label></a>
        </span>
		<em>  تحديد بلد الزائر عن طريق عنوان IP :<br/>
		<?php $ip_location = new  IP2Location();
		$country = $ip_location->getCountryFromIP("inc/ip_to_country.csv",$_SERVER['REMOTE_ADDR']);
		echo "Your IP:".$_SERVER['REMOTE_ADDR'];
		echo "<br/><img src='http://cdn.whatismyipaddress.com/images/flags/".strtolower($country['Code']).".png' />";
		echo " Your Country: ".$country['Name'];
		?>
		</em>
		<div id="popup_visitorInfo" class="popup_box">	<!-- OUR PopupBox DIV-->
	            <a href="javascript:void(0);" class="popupBoxClose"></a>
				<div id="visitorInfo_out"></div>
        </div>  	
	</div>
</div>
<?php include(TPL_DIR.$current_theme."/footer.php"); ?>